import request from '@/utils/request'

// 获取全部小区
export const getAllCommunityApi = () => request({
  url: '/community',
  method: 'get'
})

// 获取对应楼栋
export const getBuildingApi = (code) => request({
  url: '/house/building?community_code=' + code,
})

// 获取对应房屋
export const getHouseApi = (code) => request({
  url: '/house/index?building_code=' + code
})

// 获取小区列表
export const getCommunityList = (params) => request({
  url: '/community',
  method: 'get',
  params
})

// 添加小区
export const addCommunityApi = (data) => request({
  url: '/community',
  method: 'post',
  data
})

// 获取小区详情
export const getCommunityApi = (id) => request({
  url: '/community/' + id,
})

// 修改小区
export const editCommunityApi = (data) => request({
  url: '/community/' + data.id,
  method: 'put',
  data
})

// 删除小区
export const delCommunityApi = (id) => request({
  url: '/community/' + id,
  method: 'delete'
})